<template>
  <div>
      <div>
<span>科室:</span>
     <el-select v-model="query.departId"  placeholder="科室" class="filter-item" style="width: 120px"  @change="crud.toQuery">
        <el-option
            v-for='item in collectDepts'
            :key='item.id'
            :label='item.text'
            :value='item.id'
          />
     </el-select>

    <span>接诊类型:</span>
        <el-select v-model="query.consultType"  placeholder="接诊类型" class="filter-item" style="width: 120px" @change="crud.toQuery">
        <el-option
            v-for='item in typeList'
            :key='item.id'
            :label='item.text'
            :value='item.id'
          />
     </el-select>
      <!-- <el-select v-model="query.enabled" clearable size="small" placeholder="全部" class="filter-item" style="width: 120px" @change="crud.toQuery" >
      <el-option v-for="item in dict.dict.job_status" :key="item.value" :label="item.label" :value="item.value" />
    </el-select> -->
    <span>接诊医生:</span>
    <el-select v-model="query.consultDocId"  placeholder="医生" class="filter-item" style="width: 120px"   @change="crud.toQuery">
        <el-option
            v-for='item in users'
            :key='item.id'
            :label='item.text'
            :value='item.id'
          />
     </el-select>
      <!-- <el-select v-model="query.enabled" clearable size="small" placeholder="全部" class="filter-item" style="width: 120px" @change="crud.toQuery" >
      <el-option v-for="item in dict.dict.job_status" :key="item.value" :label="item.label" :value="item.value" />
    </el-select> -->
      </div>
      <div>
  <span>  姓名:</span>
    <el-input v-model="query.name" clearable size="small" placeholder="姓名" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
    <span>  选择日期:</span>
  
    <el-date-picker
          v-model="query.startTime"
          type="date"
          size="small"
          class="filter-item charges-date-picker"
          placeholder="开始日期"
          value-format="yyyy-MM-dd"
          style="width: 140px"
        >
        </el-date-picker>
    <span> 至 </span>
   
    <el-date-picker
          v-model="query.endTime"
          type="date"
          size="small"
          class="filter-item charges-date-picker"
          placeholder="结束日期"
          value-format="yyyy-MM-dd"
          style="width: 140px"
        >
        </el-date-picker>
    <rrOperation
      :crud="crud"
    />
      </div>
  

  </div>
</template>

<script>
import { header } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import {  getCollectUses, getDepartments } from '@/api/storageRoom/drugDelivery';

export default {
  components: { rrOperation },
  mixins: [header()],
  props: {
    dict: {
      type: Object,
      required: true
    }
  },
  data(){
      return{
          collectDepts: [],
      users: [],
            typeList: [
        {id: 1, text: '初诊'},
        {id: 2, text: '复诊'},
        {id: 3, text: '急诊'}
      ],
      }
  },
      created() {
    this._getDepartments();
    this._getCollectUses();
  },
  methods:{

    _getDepartments() {
      getDepartments().then(res => {
        res.forEach(item => {
          this.collectDepts.push({
            id: item.id + "",
            text: item.departmentName
          });
        });
      });
    },
    _getCollectUses() {
      getCollectUses().then(res => {
        res.content.forEach(item => {
          this.users.push({
            id: item.id + "",
            text: item.username
          });
        });
      });
    },
  }
}
</script>
